import request from '@/utils/request'
// 创建广告需要的接口

// 获取首页的微信群二维码名片
export const getCodeImg= (query) => {
  return request({
    method: 'get',
    url: `/account/erWeiMa/find`,
    params: query
  })
}


// 搜索app
export const searchApps = (data) => {
  return request({
    method: 'get',
    url: `adv/searchApps?query=${data}`,
    timeout: 80000,
  })
}


// 通过appid搜索app 不能搜词
export const searchAppById = (data) => {
  return request({
    method: 'get',
    url: `/adv/getRecommendAppid?appid=${data}`,

  })
}

// 搜索创意集
export const getSearchCreativeSets = (query) => {
  return request({
    method: 'get',
    url: `/adv/searchCreativeSets`,
     params: query
  })
}


// 获取国家位置细分
export const getSearchGeolocations = (query) => {
  return request({
    method: 'get',
    url: `/adv/searchGeolocations`,
     params: query
  })
}




// 上传创建广告数据
export const sendAdvInfo = (data) => {
  // debugger
  return request({
    timeout: 80000,
    method: 'post',
    url: 'adv/sendAdvInfo',
    data
  })
}




// 查询本广告系列组下的最高出价
export const findMaxOne = (query) => {
  // debugger
  return request({
    method: 'get',
    url: '/keyords/findMaxOne',
    params: query,
  })
}









// 创建之后付款接口
export const OrderPayment = (data) => {
  // debugger
  return request({
    method: 'post',
    url: '/UserFinance/OrderPayment',
    data
    // uid  order
  })
}

// 查询用户余额
export const findAmountPayable = (data) => {
  // debugger
  return request({
    method: 'post',
    url: '/UserFinance/findAmountPayable',
    data
    // uid  order
  })
}

// 查询支付订单信息
export const returnOrderInfo = (query) => {
  // debugger
  return request({
    method: 'get',
    url: '/UserFinance/returnOrderInfo',
    params: query
  })
}

// 财务模块查询支付订单信息
export const getOrderInfo = (query) => {
  return request({
    method: 'get',
    url: '/UserRecharge/findUserRechargeOrderid',
    params: query
  })
}

// 广告系列去重，判断后端是否有重名数据
export const isEmptyName = (query) => {
  return request({
    method: 'get',
    url: '/campaign/isEmptyName',
    params: query,
  })
}


// 广告组名称去重
export const adgroupIsEmptyName = (query) => {
  return request({
    method: 'get',
    params: query,
    url: '/adgroups/isEmptyName'
  })
}


// 新增一条广告组
export const addGroups = (data) => {
  return request({
    method: 'post',
    url: '/adgroups/add',
    data
  })
}


// 获取关键词提前发送
export const setRecommendAppid = (data) => {
  return request({
    method: 'post',
    url: 'adv/setRecommendAppid',
    params: data
  })
}
// 获取关键词点击是发送
export const getRecommendAppid = (data) => {
  return request({
    method: 'get',
    url: `adv/getRecommendAppid?appid=${data}`,
    timeout: 30000
  })
}
// 获取模板关键词和否定关键词文件
export const downloadCsv = (query) => {
  return request({
    method: 'get',
    url: `downloadCsv?file=${query}`
  })
}
// 获取证书ID和orgid
export const findCaAll = () => {
  return request({
    method: 'get',
    url: 'adv/findCaAll'
  })
}

// 判断项目名称是否重复 获取协同投放的数据
// 获取单个app数据传入query和orgId
// 获取小账户下所有数据传入orgId,query为''

export const findCampaign = (query, orgId) => {
  return request({
    method: 'get',
    url: `comsumerCampaign/findCampaign?appid=${query}&orgId=${orgId}`,
    timeout: 15000
  })
}

// 智能代投 用户提交数据接口
export const infoGatheringUser = (data) => {
  return request({
    method: 'post',
    data,
    url: `/comsumer/infoGatheringUser`
  })
}



// 根据orgid、campaignId查询某个Campaign
export const findCampaignOne = (data) => {
  return request({
    method: 'get',
    params: data,
    url: '/campaign/findCampaignOne'
  })
}
